
class AI { 
/**
 * 构造函数
 */
  async deepseek(Model,systemPrompt,userInput) {
    try {

      // 创建模型实例
      const model = wx.cloud.extend.AI.createModel("deepseek");

      // 调用AI生成评价
      const res = await model.generateText({
        model: Model,
        messages: [
          { role: "system", content: systemPrompt },
          { role: "user", content: userInput },
        ],
      });

      return res.choices[0].message.content;
    } catch (err) {
      console.error("云函数调用失败：", err);
      return "生成失败";
    }
  }
  async hunyuan(Model,systemPrompt,userInput) {
    try {

      // 创建模型实例
      const model = wx.cloud.extend.AI.createModel("hunyuan-exp");

      // 调用AI生成评价
      const res = await model.generateText({
        model: Model,
        messages: [
          { role: "system", content: systemPrompt },
          { role: "user", content: userInput },
        ],
      });

      return res.choices[0].message.content;
    } catch (err) {
      console.error("云函数调用失败：", err);
      return "生成失败";
    }
  }

}

// 导出单例实例
export default new AI();